import 'package:flutter/material.dart';
import 'package:device_info/device_info.dart';

class DeviceInfoWidget extends StatefulWidget {
  @override
  _DeviceInfoWidgetState createState() {
    // TODO: implement createState
    return _DeviceInfoWidgetState();
  }
}

class _DeviceInfoWidgetState extends State<DeviceInfoWidget> {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  AndroidDeviceInfo androidDeviceInfo;

  @override
  void initState() {
    deviceInfo.androidInfo.then((info) {
      setState(() {
        androidDeviceInfo = info;
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return androidDeviceInfo == null
        ? null
        : new Container(
      padding: EdgeInsets.only(top: 50),
      color: Colors.white,
      child: new Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(
            "version.securityPatch:${androidDeviceInfo.version.securityPatch}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.sdkInt:${androidDeviceInfo.version.sdkInt}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.release:${androidDeviceInfo.version.release}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.previewSdkInt:${androidDeviceInfo.version.previewSdkInt}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.incremental:${androidDeviceInfo.version.incremental}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.codename:${androidDeviceInfo.version.codename}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "version.baseOS:${androidDeviceInfo.version.baseOS}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "board:${androidDeviceInfo.board}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "bootloader:${androidDeviceInfo.bootloader}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "brand:${androidDeviceInfo.brand}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "device:${androidDeviceInfo.device}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "display:${androidDeviceInfo.display}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "fingerprint:${androidDeviceInfo.fingerprint}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),
          Text(
            "hardware:${androidDeviceInfo.hardware}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ), Text(
            "host:${androidDeviceInfo.host}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),Text(
            "id:${androidDeviceInfo.id}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),Text(
            "manufacturer:${androidDeviceInfo.manufacturer}",
            style: TextStyle(fontSize: 18,color: Colors.redAccent),
          ),

        ],
      ),
    );
  }
}
